7.4 数据分析结果的提取和注入 EMP_result
模块EMP_result可以提取EasyMultiProfiler
分析流程中对象中存储的数据分析结果,并可以将符合格式要求的外部数据分析结果导入对象,联合在一起进行数据分析。
7.4.1 数据分析结果的提取
当对一个组学进行多次数据分析时,已经完成的数据分析结果会被存储在对象中。模块EMP_result
可以根据需求快速提取所需数据分析的原始结果。
result <- MAE |>
EMP_assay_extract('geno_ec') |>
EMP_alpha_analysis() |>
EMP_diff_analysis(method = 'DESeq2',.formula = ~Group) |>
EMP_enrich_analysis(pvalue<0.05,keyType='ec',pvalueCutoff=0.05)
diff_re <- result |> EMP_result(info = 'EMP_diff_analysis')
alpha_re <- result |> EMP_result(info = 'EMP_alpha_analysis')
enrich_re <- result |> EMP_result(info = 'EMP_enrich_analysis')
7.4.2 数据分析结果的注入
EMP_result
模块可以将外部其他软件分析的结果导入数据对象中,协同EasyMultiProfiler
内的分析结果进行联合分析。注意:本方式与EMP_inject
实际效果一致。EMP_inject
适合灵活运用在流程中,EMP_result<-
的方式方便单独书写以确认外部导入步骤的清晰明了。用户可以根据自己的习惯选择适合的导入方式。
🏷️示例:可以将外部vegan包计算多样性结果导入EMPT
对象内。
Step1:提取微生物的物种注释数据。
tax_se <- MAE |>
EMP_assay_extract('taxonomy')
assay_data <- tax_se |>
EMP_assay_extract(action = 'get')
Step2:使用vegan包计算shannon多样性指数,并命名为new_shannon
。
assay_data <- assay_data |> tibble::column_to_rownames('primary')
shannon_index <- vegan::diversity(assay_data,index = 'shannon')
new_result <- tibble::tibble(primary=names(shannon_index),new_shannon=shannon_index)
new_result
Step3:将外部数据结果导入并进行分析。
注意:
①新增结果中的名称不允许与已经在数据结果内存在的名称重复,否则会导致模块
②注意导入过程中的
①新增结果中的名称不允许与已经在数据结果内存在的名称重复,否则会导致模块
EMP_filter
无法正常使用。例如,在本示例中需要将外部结果的shanon
指数更名为new_shannon
, 从而避免与EMP_alpha_analysis
的结果名称重复。②注意导入过程中的
赋值符号方向
### inject the new result into EMPT object
EMP_result(tax_se,
value_name = 'new_alpha',
affect_when_sample_changed=0,
affect_when_feature_changed=1,
attribute='primary',
attribute2='normal',source='user_import') <- new_result
tax_se |>
EMP_filter(sample_condition = new_shannon >4)